import java.util.Scanner;

public class Test8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String phone = "";
        int length = 0;
        do {
            System.out.println("请输入手机号：");
            phone = scanner.nextLine();
            length = 0;
            while (length < phone.length()) {
                length++;
            }
            if (length != 11) {
                System.out.println("输入错误！请输入11位手机号，当前长度为：" + length);
            }
        } while (length != 11);
        String maskedPhone = phone.substring(0, 3) + "****" + phone.substring(7);
        System.out.println("处理后：" + maskedPhone);
        scanner.close();
    }
}
